const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('./tang_poems.db');

db.serialize(() => {
  db.run(`
    CREATE TABLE IF NOT EXISTS tang_poems (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      title TEXT NOT NULL,
      author TEXT NOT NULL,
      dynasty TEXT DEFAULT '唐',
      content TEXT NOT NULL,
      translations TEXT,
      appreciation TEXT
    )
  `, (err) => {
    if (err) {
      console.error('创建表时出错:', err.message);
    } else {
      console.log('tang_poems 表已创建（如果之前没有的话）');
    }
  });
});

db.close(); 